﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace CPGE
{
    public partial class BreadCrumb : System.Web.UI.UserControl
    {
        public string menu1Url { get; set; }
        public string menu1Txt { get; set; }
        public string menu2Url { get; set; }
        public string menu2Txt { get; set; }
        public string menu3Url { get; set; }
        public string menu3Txt { get; set; }

        protected void Page_Init(object sender, EventArgs e)
        {
            // Define an HtmlLink control.
            HtmlLink myHtmlLink = new HtmlLink();
            switch (menu1Txt)
            {
                case "CPGE": myHtmlLink.Href = "~/SectionCPGE.css"; break;
                case "Formations": myHtmlLink.Href = "~/SectionFormations.css"; break;
                case "Infos pratiques": myHtmlLink.Href = "~/SectionInfos.css"; break;
          
            }
           
           
            myHtmlLink.Attributes.Add("rel", "stylesheet");
            myHtmlLink.Attributes.Add("type", "text/css");

            // Add the HtmlLink to the Head section of the page.
            Page.Header.Controls.Add(myHtmlLink);
        }


        protected override void OnPreRender(EventArgs e)
        {
           
            if (menu1Txt != null)
            {
                if (menu1Url!= null) Ariane.Text += "&nbsp;&gt;&nbsp; <a href='" + menu1Url + "'>" + menu1Txt + "</a>";
                else Ariane.Text += " &nbsp;&gt;&nbsp; " + menu1Txt;
            }
            if (menu2Txt != null)
            {
                if (menu2Url != null) Ariane.Text += "&nbsp;&gt;&nbsp; <a href='" + menu2Url + "'>" + menu2Txt + "</a>";
                else Ariane.Text += " &nbsp;&gt;&nbsp; " + menu2Txt;
            }
            if (menu3Txt != null)
            {
                if (menu3Url != null) Ariane.Text += "&nbsp;&gt;&nbsp; <a href='" + menu3Url + "'>" + menu3Txt + "</a>";
                else Ariane.Text += " &nbsp;&gt;&nbsp; " + menu3Txt;
            }
            base.OnPreRender(e);
        }
    }
}